﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ECCSystem.DataAccess;
using ECCSystem.BizRule;

using ECC_EXT_DAO.Dao;
using ECC_EXT_Entity;
using SeasonTextEntity = ECC_EXT_Entity.SeasonTextEntity;

namespace ECCSystem
{
    public partial class frm_Ext_Setting_SeasonText : Form
    {
        public frm_Ext_Setting_SeasonText()
        {
            InitializeComponent();
            _seasonTextDao = new SeasonTextDao();
        }

        private SeasonTextDao _seasonTextDao;

        private void btn_OK_Click(object sender, EventArgs e)
        {
            SeasonTextEntity _seasonTextEntity = new SeasonTextEntity();

            //Header
            _seasonTextEntity.Id = 1;
            _seasonTextEntity.Type = 1;
            _seasonTextEntity.SeasonText = this.textBox_SeasonText_Header.Text;
            _seasonTextEntity.UpdateUser = ClsCommon.gStrOperatorName;
            _seasonTextEntity.UpdateTime = DateTime.Now;
            _seasonTextDao.SaveOrUpdate(_seasonTextEntity);

            //Footer
            _seasonTextEntity.Id = 2;
            _seasonTextEntity.Type = 2;
            _seasonTextEntity.SeasonText = this.textBox_SeasonText_Footer.Text;
            _seasonTextDao.SaveOrUpdate(_seasonTextEntity);

        }

        private void frm_Ext_Setting_SeasonText_Load(object sender, EventArgs e)
        {
            SeasonTextEntity _seasonTextEntity = new SeasonTextEntity();

            _seasonTextEntity.Id = 1;
            _seasonTextEntity =
                _seasonTextDao.GetById(_seasonTextEntity);
            this.textBox_SeasonText_Header.Text = _seasonTextEntity.SeasonText;
            _seasonTextEntity.Id = 2;
            _seasonTextEntity =
                _seasonTextDao.GetById(_seasonTextEntity);
            this.textBox_SeasonText_Footer.Text = _seasonTextEntity.SeasonText;
        }
    }
}
